<!DOCTYPE HTML>
<html lang="en" >
    
    <head>
        
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>vue生命周期 | 个人笔记</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="../gitbook/style.css">
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-expandable-chapters/expandable-chapters.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-search/search.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="../other/oth4.html" />
    
    
    <link rel="prev" href="../other/oth2.html" />
    

        
    </head>
    <body>
        
        
    <div class="book"
        data-level="7.2"
        data-chapter-title="vue生命周期"
        data-filepath="other/oth3.md"
        data-basepath=".."
        data-revision="Fri Oct 19 2018 22:35:09 GMT+0800 (中国标准时间)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../index.html">
                
                        <i class="fa fa-check"></i>
                        
                        Introduction
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="HTML/HTML1.html">
            
                
                    <a href="../HTML/HTML1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        HTML
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1" data-path="HTML/HTML2.html">
            
                
                    <a href="../HTML/HTML2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.</b>
                        
                        HTML元素分类
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="HTML/HTML3.html">
            
                
                    <a href="../HTML/HTML3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.</b>
                        
                        HTML图片路径设置
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="HTML/HTML4.html">
            
                
                    <a href="../HTML/HTML4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.</b>
                        
                        HTML表格
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="HTML/HTML5.html">
            
                
                    <a href="../HTML/HTML5.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.</b>
                        
                        HTML实体字符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="HTML/HTML6.html">
            
                
                    <a href="../HTML/HTML6.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.5.</b>
                        
                        HTML列表
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="HTML/HTML7.html">
            
                
                    <a href="../HTML/HTML7.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.6.</b>
                        
                        HTML常见的元素
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="HTML/HTML8.html">
            
                
                    <a href="../HTML/HTML8.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.7.</b>
                        
                        HTML新增及删除的元素
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2" data-path="CSS/CSS.html">
            
                
                    <a href="../CSS/CSS.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        CSS
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1" data-path="CSS/CSS1.html">
            
                
                    <a href="../CSS/CSS1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        css引入方式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="CSS/CSS2.html">
            
                
                    <a href="../CSS/CSS2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.</b>
                        
                        css表格
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="CSS/CSS3.html">
            
                
                    <a href="../CSS/CSS3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.</b>
                        
                        css元素盒子模型及元素类型
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="CSS/CSS4.html">
            
                
                    <a href="../CSS/CSS4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.</b>
                        
                        css处理文字溢出方式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="CSS/CSS5.html">
            
                
                    <a href="../CSS/CSS5.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.5.</b>
                        
                        css伪类选择符及命名方式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.6" data-path="CSS/CSS6.html">
            
                
                    <a href="../CSS/CSS6.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.6.</b>
                        
                        css选择符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.7" data-path="CSS/CSS7.html">
            
                
                    <a href="../CSS/CSS7.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.7.</b>
                        
                        css清除浮动
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3" data-path="mobile/mb.html">
            
                
                    <a href="../mobile/mb.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        Mobile
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1" data-path="mobile/mb1.html">
            
                
                    <a href="../mobile/mb1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.1.</b>
                        
                        Mobile rem布局
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="mobile/mb2.html">
            
                
                    <a href="../mobile/mb2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.</b>
                        
                        Mobile 权重值
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="mobile/mb3.html">
            
                
                    <a href="../mobile/mb3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.3.</b>
                        
                        Mobile 栅格化布局
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4" data-path="js/js.html">
            
                
                    <a href="../js/js.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                        js
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1" data-path="js/js2.html">
            
                
                    <a href="../js/js2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.1.</b>
                        
                        JavaScript 数据类型
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="js/js3.html">
            
                
                    <a href="../js/js3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.2.</b>
                        
                        JavaScript 数据类型2
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="js/js4.html">
            
                
                    <a href="../js/js4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.3.</b>
                        
                        JavaScript 数据类型转换
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.4" data-path="js/js5.html">
            
                
                    <a href="../js/js5.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.4.</b>
                        
                        JavaScript 运算符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.5" data-path="js/js6.html">
            
                
                    <a href="../js/js6.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.5.</b>
                        
                        JavaScript 运算符2
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.6" data-path="js/js7.html">
            
                
                    <a href="../js/js7.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.6.</b>
                        
                        JavaScript 运算符3
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.7" data-path="js/js8.html">
            
                
                    <a href="../js/js8.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.7.</b>
                        
                        JavaScript 运算符4
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.8" data-path="js/js9.html">
            
                
                    <a href="../js/js9.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.8.</b>
                        
                        JavaScript 条件语句和循环语句
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5" data-path="vue/vue.html">
            
                
                    <a href="../vue/vue.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.</b>
                        
                        vue
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.1" data-path="vue/vue2.html">
            
                
                    <a href="../vue/vue2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.1.</b>
                        
                        vue指令
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.2" data-path="vue/vue3.html">
            
                
                    <a href="../vue/vue3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.2.</b>
                        
                        vue绑定class和style
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.3" data-path="vue/vue4.html">
            
                
                    <a href="../vue/vue4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.3.</b>
                        
                        vue条件渲染
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.4" data-path="vue/vue5.html">
            
                
                    <a href="../vue/vue5.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.4.</b>
                        
                        vue绑定表单
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.5" data-path="vue/vue6.html">
            
                
                    <a href="../vue/vue6.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.5.</b>
                        
                        vue路由
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.6" data-path="vue/vue7.html">
            
                
                    <a href="../vue/vue7.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.6.</b>
                        
                        vue-cli3脚手架安装
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.7" data-path="vue/vue8.html">
            
                
                    <a href="../vue/vue8.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.7.</b>
                        
                        vue组件之间的通讯
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6" data-path="smallpro/sp.html">
            
                
                    <a href="../smallpro/sp.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.</b>
                        
                        smallpro
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7" data-path="other/oth.html">
            
                
                    <a href="../other/oth.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.</b>
                        
                        其余重点
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="7.1" data-path="other/oth2.html">
            
                
                    <a href="../other/oth2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.1.</b>
                        
                        什么叫跨域
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="7.2" data-path="other/oth3.html">
            
                
                    <a href="../other/oth3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.2.</b>
                        
                        vue生命周期
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.3" data-path="other/oth4.html">
            
                
                    <a href="../other/oth4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.3.</b>
                        
                        vue事件绑定
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.4" data-path="other/oth5.html">
            
                
                    <a href="../other/oth5.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.4.</b>
                        
                        原型链
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.5" data-path="other/oth6.html">
            
                
                    <a href="../other/oth6.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.5.</b>
                        
                        箭头函数
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.6" data-path="other/oth7.html">
            
                
                    <a href="../other/oth7.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.6.</b>
                        
                        vue和vuex的区别
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.7" data-path="other/oth8.html">
            
                
                    <a href="../other/oth8.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.7.</b>
                        
                        js的继承方式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.8" data-path="other/oth9.html">
            
                
                    <a href="../other/oth9.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.8.</b>
                        
                        一次完整的HTTP事务
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.9" data-path="other/oth10.html">
            
                
                    <a href="../other/oth10.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.9.</b>
                        
                        var和let声明变量的区别
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.10" data-path="other/oth11.html">
            
                
                    <a href="../other/oth11.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.10.</b>
                        
                        浏览器兼容问题
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.11" data-path="other/oth12.html">
            
                
                    <a href="../other/oth12.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.11.</b>
                        
                        JS 事件绑定、事件监听、事件委托
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.12" data-path="other/oth13.html">
            
                
                    <a href="../other/oth13.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.12.</b>
                        
                        数据类型
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.13" data-path="other/oth14.html">
            
                
                    <a href="../other/oth14.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.13.</b>
                        
                        jq封装Ajax
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.14" data-path="other/oth15.html">
            
                
                    <a href="../other/oth15.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.14.</b>
                        
                        设置元素垂直居中或文字居中的方式
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="8" data-path="Interview/In.html">
            
                
                    <a href="../Interview/In.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.</b>
                        
                        面试题库
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="8.1" data-path="Interview/In2.html">
            
                
                    <a href="../Interview/In2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.1.</b>
                        
                        面试题库
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    Published with GitBook
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../" >个人笔记</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h3 id="vue&#x751F;&#x547D;&#x5468;&#x671F;">vue&#x751F;&#x547D;&#x5468;&#x671F;</h3>
<pre><code>vue&#x751F;&#x547D;&#x5468;&#x671F;
    vue&#x5B9E;&#x4F8B;&#x4ECE;&#x521B;&#x5EFA;&#x5230;&#x9500;&#x6BC1;&#x7684;&#x8FC7;&#x7A0B;

&#x9996;&#x5148;&#x9700;&#x8981;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x5B9E;&#x4F8B;&#xFF0C;&#x4E5F;&#x5C31;&#x662F;&#x5728; new Vue ( ) &#x7684;&#x5BF9;&#x8C61;&#x8FC7;&#x7A0B;&#x5F53;&#x4E2D;&#xFF0C;
&#x9996;&#x5148;&#x6267;&#x884C;&#x4E86;init&#xFF08;init&#x662F;vue&#x7EC4;&#x4EF6;&#x91CC;&#x9762;&#x9ED8;&#x8BA4;&#x53BB;&#x6267;&#x884C;&#x7684;&#xFF09;&#xFF0C;
&#x5728;init&#x7684;&#x8FC7;&#x7A0B;&#x5F53;&#x4E2D;&#x9996;&#x5148;&#x8C03;&#x7528;&#x4E86;beforeCreate&#xFF0C;&#x7136;&#x540E;&#x5728;injections&#xFF08;&#x6CE8;&#x5C04;&#xFF09;&#x548C;reactivity&#xFF08;&#x53CD;&#x5E94;&#x6027;&#xFF09;&#x7684;&#x65F6;&#x5019;&#xFF0C;
&#x5B83;&#x4F1A;&#x518D;&#x53BB;&#x8C03;&#x7528;created&#x3002;&#x6240;&#x4EE5;&#x5728;init&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x4E8B;&#x4EF6;&#x5DF2;&#x7ECF;&#x8C03;&#x7528;&#x4E86;&#xFF0C;
&#x6211;&#x4EEC;&#x5728;beforeCreate&#x7684;&#x65F6;&#x5019;&#x5343;&#x4E07;&#x4E0D;&#x8981;&#x53BB;&#x4FEE;&#x6539;data&#x91CC;&#x9762;&#x8D4B;&#x503C;&#x7684;&#x6570;&#x636E;&#xFF0C;
&#x6700;&#x65E9;&#x4E5F;&#x8981;&#x653E;&#x5728;created&#x91CC;&#x9762;&#x53BB;&#x505A;&#xFF08;&#x6DFB;&#x52A0;&#x4E00;&#x4E9B;&#x884C;&#x4E3A;&#xFF09;&#x3002;

&#x5F53;created&#x5B8C;&#x6210;&#x4E4B;&#x540E;&#xFF0C;&#x5B83;&#x4F1A;&#x53BB;&#x5224;&#x65AD;instance&#xFF08;&#x5B9E;&#x4F8B;&#xFF09;&#x91CC;&#x9762;&#x662F;&#x5426;&#x542B;&#x6709;&#x201C;el&#x201D;option&#xFF08;&#x9009;&#x9879;&#xFF09;&#xFF0C;
&#x5982;&#x679C;&#x6CA1;&#x6709;&#x7684;&#x8BDD;&#xFF0C;&#x5B83;&#x4F1A;&#x8C03;&#x7528;vm.$mount(el)&#x8FD9;&#x4E2A;&#x65B9;&#x6CD5;&#xFF0C;&#x7136;&#x540E;&#x6267;&#x884C;&#x4E0B;&#x4E00;&#x6B65;&#xFF1B;&#x5982;&#x679C;&#x6709;&#x7684;&#x8BDD;&#xFF0C;
&#x76F4;&#x63A5;&#x6267;&#x884C;&#x4E0B;&#x4E00;&#x6B65;&#x3002;&#x7D27;&#x63A5;&#x7740;&#x4F1A;&#x5224;&#x65AD;&#x662F;&#x5426;&#x542B;&#x6709;&#x201C;template&#x201D;&#x8FD9;&#x4E2A;&#x9009;&#x9879;&#xFF0C;&#x5982;&#x679C;&#x6709;&#x7684;&#x8BDD;&#xFF0C;
&#x5B83;&#x4F1A;&#x628A;template&#x89E3;&#x6790;&#x6210;&#x4E00;&#x4E2A;render function &#xFF0C;&#x8FD9;&#x662F;&#x4E00;&#x4E2A;template&#x7F16;&#x8BD1;&#x7684;&#x8FC7;&#x7A0B;&#xFF0C;
&#x7ED3;&#x679C;&#x662F;&#x89E3;&#x6790;&#x6210;&#x4E86;render&#x51FD;&#x6570;
render&#x51FD;&#x6570;&#x91CC;&#x9762;&#x7684;&#x4F20;&#x53C2;h&#x5C31;&#x662F;Vue&#x91CC;&#x9762;&#x7684;createElement&#x65B9;&#x6CD5;&#xFF0C;
return&#x8FD4;&#x56DE;&#x4E00;&#x4E2A;createElement&#x65B9;&#x6CD5;&#xFF0C;&#x5176;&#x4E2D;&#x8981;&#x4F20;3&#x4E2A;&#x53C2;&#x6570;&#xFF0C;
&#x7B2C;&#x4E00;&#x4E2A;&#x53C2;&#x6570;&#x5C31;&#x662F;&#x521B;&#x5EFA;&#x7684;div&#x6807;&#x7B7E;&#xFF1B;&#x7B2C;&#x4E8C;&#x4E2A;&#x53C2;&#x6570;&#x4F20;&#x4E86;&#x4E00;&#x4E2A;&#x5BF9;&#x8C61;&#xFF0C;
&#x5BF9;&#x8C61;&#x91CC;&#x9762;&#x53EF;&#x4EE5;&#x662F;&#x6211;&#x4EEC;&#x7EC4;&#x4EF6;&#x4E0A;&#x9762;&#x7684;props&#xFF0C;&#x6216;&#x8005;&#x662F;&#x4E8B;&#x4EF6;&#x4E4B;&#x7C7B;&#x7684;&#x4E1C;&#x897F;&#xFF1B;
&#x7B2C;&#x4E09;&#x4E2A;&#x53C2;&#x6570;&#x5C31;&#x662F;div&#x6807;&#x7B7E;&#x91CC;&#x9762;&#x7684;&#x5185;&#x5BB9;&#xFF0C;&#x8FD9;&#x91CC;&#x6211;&#x4EEC;&#x6307;&#x5411;&#x4E86;data&#x91CC;&#x9762;&#x7684;text&#x3002;

&#x4F7F;&#x7528;render&#x51FD;&#x6570;&#x7684;&#x7ED3;&#x679C;&#x548C;&#x6211;&#x4EEC;&#x4E4B;&#x524D;&#x4F7F;&#x7528;template&#x89E3;&#x6790;&#x51FA;&#x6765;&#x7684;&#x7ED3;&#x679C;&#x662F;&#x4E00;&#x6837;&#x7684;&#x3002;
render&#x51FD;&#x6570;&#x662F;&#x53D1;&#x751F;&#x5728;beforeMount&#x548C;mounted&#x4E4B;&#x95F4;&#x7684;&#xFF0C;&#x8FD9;&#x4E5F;&#x4ECE;&#x4FA7;&#x9762;&#x8BF4;&#x660E;&#x4E86;&#xFF0C;
&#x5728;beforeMount&#x7684;&#x65F6;&#x5019;&#xFF0C;$el&#x8FD8;&#x53EA;&#x662F;&#x6211;&#x4EEC;&#x5728;HTML&#x91CC;&#x9762;&#x5199;&#x7684;&#x8282;&#x70B9;&#xFF0C;&#x7136;&#x540E;&#x5230;mounted&#x7684;&#x65F6;&#x5019;&#xFF0C;
&#x5B83;&#x5C31;&#x628A;&#x6E32;&#x67D3;&#x51FA;&#x6765;&#x7684;&#x5185;&#x5BB9;&#x6302;&#x8F7D;&#x5230;&#x4E86;DOM&#x8282;&#x70B9;&#x4E0A;&#x3002;&#x8FD9;&#x4E2D;&#x95F4;&#x7684;&#x8FC7;&#x7A0B;&#x5176;&#x5B9E;&#x662F;&#x6267;&#x884C;&#x4E86;render function&#x7684;&#x5185;&#x5BB9;&#x3002;

&#x5728;&#x4F7F;&#x7528;.vue&#x6587;&#x4EF6;&#x5F00;&#x53D1;&#x7684;&#x8FC7;&#x7A0B;&#x5F53;&#x4E2D;&#xFF0C;&#x6211;&#x4EEC;&#x5728;&#x91CC;&#x9762;&#x5199;&#x4E86;template&#x6A21;&#x677F;&#xFF0C;
&#x5728;&#x7ECF;&#x8FC7;&#x4E86;vue-loader&#x7684;&#x5904;&#x7406;&#x4E4B;&#x540E;&#xFF0C;&#x5C31;&#x53D8;&#x6210;&#x4E86;render function&#xFF0C;
&#x6700;&#x7EC8;&#x653E;&#x5230;&#x4E86;vue-loader&#x89E3;&#x6790;&#x8FC7;&#x7684;&#x6587;&#x4EF6;&#x91CC;&#x9762;&#x3002;&#x8FD9;&#x6837;&#x505A;&#x6709;&#x4EC0;&#x4E48;&#x597D;&#x5904;&#x5462;&#xFF1F;
&#x539F;&#x56E0;&#x662F;&#x7531;&#x4E8E;&#x5728;&#x89E3;&#x6790;template&#x53D8;&#x6210;render function&#x7684;&#x8FC7;&#x7A0B;&#xFF0C;&#x662F;&#x4E00;&#x4E2A;&#x975E;&#x5E38;&#x8017;&#x65F6;&#x7684;&#x8FC7;&#x7A0B;&#xFF0C;
vue-loader&#x5E2E;&#x6211;&#x4EEC;&#x5904;&#x7406;&#x4E86;&#x8FD9;&#x4E9B;&#x5185;&#x5BB9;&#x4E4B;&#x540E;&#xFF0C;&#x5F53;&#x6211;&#x4EEC;&#x5728;&#x9875;&#x9762;&#x4E0A;&#x6267;&#x884C;vue&#x4EE3;&#x7801;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x6548;&#x7387;&#x4F1A;&#x53D8;&#x5F97;&#x66F4;&#x9AD8;&#x3002;

beforeMount&#x5728;&#x6709;&#x4E86;render function&#x7684;&#x65F6;&#x5019;&#x624D;&#x4F1A;&#x6267;&#x884C;&#xFF0C;
&#x5F53;&#x6267;&#x884C;&#x5B8C;render function&#x4E4B;&#x540E;&#xFF0C;&#x5C31;&#x4F1A;&#x8C03;&#x7528;mounted&#x8FD9;&#x4E2A;&#x94A9;&#x5B50;&#xFF0C;
&#x5728;mounted&#x6302;&#x8F7D;&#x5B8C;&#x6BD5;&#x4E4B;&#x540E;&#xFF0C;&#x8FD9;&#x4E2A;&#x5B9E;&#x4F8B;&#x5C31;&#x7B97;&#x662F;&#x8D70;&#x5B8C;&#x6D41;&#x7A0B;&#x4E86;&#x3002;

vue&#x751F;&#x547D;&#x5468;&#x671F;&#x51FD;&#x6570;&#x4E3B;&#x8981;&#x6709;&#x4EE5;&#x4E0B;10&#x4E2A;&#xFF1A;

1.beforeCreate:&#x8868;&#x793A;&#x7EC4;&#x4EF6;&#x5B9E;&#x4F8B;&#x521A;&#x521A;&#x88AB;&#x521B;&#x5EFA;&#xFF0C;&#x7EC4;&#x4EF6;&#x5C5E;&#x6027;&#x8BA1;&#x7B97;&#x4E4B;&#x524D;&#xFF0C;&#x5982;data&#x5C5E;&#x6027;&#x7B49;
2.created:&#x8868;&#x793A;&#x7EC4;&#x4EF6;&#x5B9E;&#x4F8B;&#x521B;&#x5EFA;&#x5B8C;&#x6210;&#xFF0C;&#x5C5E;&#x6027;&#x5DF2;&#x7ECF;&#x7ED1;&#x5B9A;&#x4F46;&#x662F;&#x9875;&#x9762;&#x4E0A;&#x7684;dom&#x5143;&#x7D20;&#x8FD8;&#x672A;&#x751F;&#x6210;&#xFF0C;$el&#x5C5E;&#x6027;&#x8FD8;&#x4E0D;&#x5B58;&#x5728;
3.beforeMount:&#x8868;&#x793A;&#x7EC4;&#x6A21;&#x677F;&#x7F16;&#x8BD1;&#x548C;&#x6302;&#x8F7D;&#x4E4B;&#x524D;
4.mounted:&#x8868;&#x793A;&#x7EC4;&#x6A21;&#x677F;&#x7F16;&#x8BD1;&#x548C;&#x6302;&#x8F7D;&#x4E4B;&#x524D;
5.beforeUpdate:&#x8868;&#x793A;&#x7EC4;&#x4EF6;&#x66F4;&#x65B0;&#x4E4B;&#x524D;
6.updated:&#x8868;&#x793A;&#x7EC4;&#x4EF6;&#x66F4;&#x65B0;&#x4E4B;&#x540E;
7.beforeDestory:&#x8868;&#x793A;&#x7EC4;&#x4EF6;&#x9500;&#x6BC1;&#x4E4B;&#x524D;
8.destoryed:&#x8868;&#x793A;&#x7EC4;&#x4EF6;&#x7EC4;&#x4EF6;&#x9500;&#x6BC1;&#x4E4B;&#x540E;
9.activated:&#x8868;&#x793A;&#x7EC4;&#x4EF6;&#x88AB;&#x6FC0;&#x6D3B;&#x65F6;&#x5019;&#x89E6;&#x53D1;&#xFF0C;&#x5E38;&#x4E0E;keep-alive&#x8054;&#x7CFB;
10.deactivated:&#x8868;&#x793A;&#x7EC4;&#x4EF6;&#x88AB;&#x79FB;&#x9664;&#x7684;&#x65F6;&#x5019;&#x89E6;&#x53D1;&#xFF0C;&#x5E38;&#x4E0E;keep-alive&#x8054;&#x7CFB;
</code></pre>
                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../other/oth2.html" class="navigation navigation-prev " aria-label="Previous page: 什么叫跨域"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../other/oth4.html" class="navigation navigation-next " aria-label="Next page: vue事件绑定"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../gitbook/app.js"></script>

    
    <script src="../gitbook/plugins/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-search/search.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-livereload/plugin.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"expandable-chapters":{},"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"livereload":{}};
    gitbook.start(config);
});
</script>

        
    </body>
    
</html>
